package demo1;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-04-04
 * Time: 20:09
 */
public class Test {
    public static List<List<Integer>> generate(int numRows) {
        List<List<Integer>> ret = new ArrayList<>();

        List<Integer> list = new ArrayList<>();
        list.add(1);

        ret.add(list);
        for (int i = 1; i < numRows; i++) {

            List<Integer> curRow = new ArrayList<>();
            curRow.add(1);
//处理中间的数字
            List<Integer> preRow = ret.get(i - 1);
            for (int j = 1; j < i; j++) {
                curRow.add(preRow.get(j) + preRow.get(j - 1));
            }
//最后一个数字1
            curRow.add(1);

            ret.add(curRow);
        }
        return ret;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        List<List<Integer>> san = generate(n);
        for (int i = 0; i < n; i++) {
            List<Integer> ret = san.get(i);
            for (int j = 0; j < ret.size(); j++) {
                System.out.print(ret.get(j) + " ");
            }
            System.out.println();
        }
    }
    private static final String[] SUITS = {"♥","♠","♣","♦"};
    public static List<Card> buyCard() {
        List<Card> cards = new ArrayList<>();
        for (int i = 0; i < SUITS.length; i++) {
            for (int j = 1; j < 14; j++) {
                Card card = new Card(SUITS[i], j);
                cards.add(card);
            }
        }
        return cards;
    }
    public static void shuffle(List<Card> cards) {
        Random random = new Random();
        for (int i = cards.size() - 1; i > 0; i--) {
            int j = random.nextInt(i );
            Card card = cards.get(i);
            cards.set(i,cards.get(j));
            cards.set(j,card);
        }

    }
    public static void main4(String[] args) {
        List<Card> cards = buyCard();
        shuffle(cards);
        System.out.println(cards);
//        List<List<Card>> hand = new ArrayList<>();
//        List<Card> hand1 = new ArrayList<>();
//        List<Card> hand2 = new ArrayList<>();
//        List<Card> hand3 = new ArrayList<>();
//        hand.add(hand1);
//        hand.add(hand2);
//        hand.add(hand3);
//        for (int i = 0; i < 5; i++) {
//            for (int j = 0; j < 3; j++) {
//                Card card = cards.remove(0);
//                hand.get(j).add(card);
//            }
//        }
//        System.out.println("1."+hand1);
//        System.out.println("2."+hand2);
//        System.out.println("3."+hand3);
//        System.out.println("剩余："+cards);
    }
}
